/*
 * @Author: new-wang
 * @Date: 2025-08-21 14:20:54
 * @LastEditors: new-wang
 * @LastEditTime: 2025-08-25 09:02:34
 * @FilePath: \nest-demo\src\module\system\auth\auth.controller.ts
 * @Description: 权限认证 - 包括登录、登出、注册、鉴权等
 */
import {
  Controller,
  Get,
  Req,
  Post,
  Param,
  Body,
  HttpCode,
} from '@nestjs/common'
import { RegisterDto } from './dto'
import { ApiBody, ApiOperation } from '@nestjs/swagger'
import { AuthService } from './auth.service'

@Controller('auth')
export class AuthController {
  constructor(private readonly authService: AuthService) {}

  @Get('/login')
  login(@Req() request: Request): string {
    console.log('登录请求:', request)
    return '登录接口'
  }

  @ApiOperation({
    summary: '用户注册',
  })
  @ApiBody({
    type: RegisterDto,
    required: true,
    description: '用户注册信息',
  })
  @Post('/register')
  @HttpCode(200)
  register(@Body() user: RegisterDto) {
    console.log('注册请求:', user)
    // 这里可以添加注册逻辑，比如保存用户信息到数据库
    return this.authService.register(user)
  }
}
